package com.mgg.user.service.impl;

import com.mgg.common.dao.DaoSupport;
import com.mgg.user.entity.ProviderUserDO;
import com.mgg.user.entity.ShopDO;
import com.mgg.common.entity.UserDO;
import com.mgg.user.service.BaseUserService;
import com.mgg.common.vo.AccountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: lijun
 * @Date: 2018/9/13 15:56
 */
@Service("baseUserService")
public class BaseUserServiceImpl implements BaseUserService{

    @Autowired
    private DaoSupport dao;

    @Override
    public UserDO getUserByUserId(String userId) {
        UserDO user = dao.findForObject("BaseUserMapper.getUserByUserId",userId);
        return user;
    }

    @Override
    public UserDO getUserByPhone(String phone) {
        UserDO user = dao.findForObject("BaseUserMapper.getUserByPhone",phone);
        return user;
    }

    @Override
    public UserDO getUserByShopCode(String shopCode) {
        UserDO user = dao.findForObject("BaseUserMapper.getUserByShopCode",shopCode);
        return user;
    }

    @Override
    public ProviderUserDO getProviderUserByUserId(String userId) {
        ProviderUserDO providerUserDO = dao.findForObject("BaseUserMapper.getProviderUserByUserId", userId);
        return providerUserDO;
    }

    @Override
    public ShopDO getShopByUserId(String userId) {
        ShopDO shopDO = dao.findForObject("BaseUserMapper.getShopByUserId", userId);
        return shopDO;
    }

    @Override
    public UserDO getSuperUserByUserId(String userId) {
        UserDO user = dao.findForObject("BaseUserMapper.getSuperUserByUserId",userId);
        return user;
    }

    @Override
    public AccountVO getUserAccountByUserId(String userId) {
        AccountVO accountVO = dao.findForObject("BaseUserMapper.getUserAccountByUserId", userId);
        return accountVO;
    }

    @Override
    public String getUserCodesByUserId(String userId) {
        return dao.findForObject("BaseUserMapper.getUserCodesByUserId", userId);
    }

}
